var api = require('../../../../utils/api.js');
const app = getApp();
Page({


  /**
   * 页面的初始数据
   */
  data: {
    kaishi: 0,
    guanbi: 1,
    userInfo: app.globalData.userInfo,
    upload: app.globalData.upload
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    this.audioCtx = wx.createAudioContext('myAudio');
    this.audioCtx.play();
    var that = this;
    that.setData({
      userInfo: app.globalData.userInfo,
      upload: app.globalData.upload
    })
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    var that = this;
    if (app.globalData.userInfo) {
     
      that.setData({
        userInfo: app.globalData.userInfo,
        hasUserInfo: true
      })
    } else {
      // 在没有 open-type=getUserInfo 版本的兼容处理
     
      app.getUserInfo(function (userInfo) {
        //更新数据
        
        that.setData({
          userInfo: userInfo,
          loadingHidden: true
        })
      });
    }
  },
  audioPlay: function () {
    this.audioCtx.play()
    this.setData({
      guanbi: 555,
      kaishi: 2

    })
  },
  audioPause: function () {
    this.audioCtx.pause()
    this.setData({
      guanbi: 2,
      kaishi: 555

    })
  },
  ondashang: function () {
    wx.navigateTo({
      url: '../../../areward/areward',
    });
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var user = this.data.userInfo.nickName;
    return {
      title: user + '祝您九九重阳节快乐！',
      desc: '大家都在送祝福，你也来给朋友送祝福吧!',
      path: '/pages/index/chongyang/nongqing/nongqing'
    }
  
  }
})